/* 自定义指令 格式化报价商品addon */
Vue.directive('parsing-text', function (el, binding) {
    var val = binding.value;
    var content = '';
    for (var v in val){
        content += val[v] + ' ';
    }
    el.textContent = content
})

var itemQuoteDetailVm  = new Vue({
    el: '#itemQuoteDetailPage',
    data: {
        pageVisible: false,
        name: '',
        goodsType: '',
        orderItemQuote: {}
    },
    methods: {
        loadData(data) {
            this.resolve(data.itemId)
            this.name = data.name
            this.goodsType = data.goodsType
        },
        resolve(itemId){
            var self = this;
            $.get(baseURL + "order/orderitem/resolveQuoteItem/" + itemId, function(r){
                if (r.code == 0){
                    if (isBlank(r.orderItemQuote.totalTotalPrice)){
                        self.$message.error('解析失败，请联系后台管理员');
                    }else {
                        self.orderItemQuote = r.orderItemQuote
                        self.pageVisible = true
                    }
                }else {
                    self.$message.error('解析失败，请联系后台管理员');
                }
            });
        },
        goBack(){
            this.pageVisible = false
        },
        closePage() {},
    }
})